<script type="text/javascript">
    function on_submit(){
        var desc=$('#desc_<?php echo $post_id?>').val();
        var tag_id=$('#tag_<?php echo $post_id?>').val();
        // alert(desc);
        <?php
        if($type == 1){
        ?>
        $.ajax({
            type:'post',
            url:"index.php?c=post&m=up_post",
            data:{'id':<?php echo $post_id; ?>,'desc':desc},
            dataType:'json',
            success:function(result){
                if(result['status'] == 1){
                    alert("已经标记为审核不通过");
                    $('.status_<?php echo $post_id;?>').text("已审核（未通过）");
                    $('.status_<?php echo $post_id;?>').css({'color':'red'});
                }else{
                    alert("审核不通过失败")
                }
            }
        });
        <?php }elseif($type == 2){?>
        if(confirm("确定删除吗？")) {
            if (tag_id == '') {
                alert('请选择删除原因,谢谢合作！！！');
                return false;
            }
            $.ajax({
                type: 'post',
                url: "index.php?c=post&m=del_post",
                data: {'id':<?php echo $post_id; ?>, 'desc': desc, 'tag_id': tag_id},
                dataType: 'json',
                success: function (result) {
                    if (result['status'] == 1) {
                        alert("删除成功");
                        $('.status_<?php echo $post_id;?>').text("已审核（已删除）");
                        $('.status_<?php echo $post_id;?>').css({'color': 'red'});
                        //删除时切换
                        $('#is_show_<?php echo $post_id?>').show();
                        $('#is_check_<?php echo $post_id?>').hide();
                    } else {
                        alert("删除失败")
                    }
                }
            });
        }
        <?php }else{?>
        $.ajax({
            type:'post',
            url:"index.php?c=post&m=recovery_post",
            data:{'id':<?php echo $post_id; ?>,'desc':desc},
            dataType:'json',
            success:function(result){
                if(result['status'] == 1){
                    alert("恢复成功");
                    $('.status_<?php echo $post_id;?>').text("未审核（已成功）");
                    $('.status_<?php echo $post_id;?>').css({'color':'red'});
                    //加一个隐藏
                    $('#is_show_<?php echo $post_id?>').hide();
                    $('#is_check_<?php echo $post_id?>').show();
                }else{
                    alert("恢复失败")
                }
            }
        });
        <?php }?>

        $('#img_list').modal('hide');
        $('#img_list').click();
    }
    $("#img_list").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
    });
</script>
<div class="tab-pane active" id="horizontal-form">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h2 class="modal-title"><?php echo $pageTitle;?></h2>
    </div>

    <form class="form-horizontal" id="admin_edit_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">
        <input type="hidden" name="submits" value="1"/>
        <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>"/>
        <input type="hidden" name="type" id="type" value="<?php echo $type; ?>"/>
        <?php if($type == 2){?>

        <div class="form-group">
            <label for="birth" class="col-sm-2 control-label">请选择删除原因：</label>
            <div class="col-sm-4">
                <select  name="tag_<?php echo $post_id?>" id="tag_<?php echo $post_id?>" class="form-control">
                    <option value="">请选择原因</option>
                    <?php
                    $reportTag = $this->ReportModel->tag;
                    foreach ($reportTag as $k=>$v){
                        $str='<option value="'.$k.'">'.$v;
                        $str.='</option>';
                        echo $str;
                    }
                    ?>
                </select>
            </div>
        </div>
        <?php }?>

        <div class="form-group">
            <label for="birth" class="col-sm-2 control-label">备注：</label>
            <div class="col-sm-4">
                <textarea cols="95" rows="4" class="form-control update_desc" id="desc_<?php echo $post_id?>" placeholder="请输入操作理由"></textarea>
            </div>
        </div>
        <div class="modal-footer">
            <button type="reset" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" onclick="on_submit()" class="btn btn-primary">保存</button>
        </div>
    </form>
</div>